<?php
/**
 * Created by PhpStorm.
 * User: yf
 * Date: 2016/8/11
 * Time: 14:01
 */
namespace SDXApi\Model;
use Think\Model;

class AdpositionModel extends Model
{
    protected $tableName = 'ad_position';
    /*
     * 获取所有广告位
     * 
     * */
    public function get_ad_location(){
        $res=$this->field('position_id,position_name,ad_width,ad_height,position_desc,position_style')
            ->select();
        if($res){
            return $res;
        }else{
            return false;
        }

    }

    public function get_ad_location2($goods_category){

        $array_c = array($goods_category,-2);
        $where['goods_category'] = array("in",$array_c);

        $res=$this->field('position_id,position_name,ad_width,ad_height,position_desc,position_style,goods_category')
            ->where("goods_category in (".$goods_category.",-2)")->order('goods_category','desc')->select();
        //dump($this->getlastsql());
        if($res){

            return $res;
        }else{
            return false;
        }

    }

}